from pymysql import Connection

conn = Connection(
    host='localhost',
    port=3306,
    user='root',
    password='15033656612czt',
    autocommit=True  # 设置自动提交
)

# 获取游标对象
cursor = conn.cursor()
# 选择数据库
conn.select_db("test")
cursor.execute("insert into student values (1, '张三', 23, '男')")
# result: tuple = cursor.fetchall()
# for row in result:
#     print(row)

conn.close()
